package com.iot.ammeter.network.mock

import com.iot.ammeter.model.Response1
import com.iot.ammeter.model.parcelable.UserInfo
import com.iot.ammeter.network.LOGIN_URL
import com.iot.ammeter.network.MockResponse
import com.iot.ammeter.network.REGISTER_URL
import com.iot.ammeter.network.ResponseWrap
import com.iot.ammeter.network.services.AuthService
import retrofit2.Call
import retrofit2.http.Field
import retrofit2.http.POST
import retrofit2.mock.BehaviorDelegate
import java.util.*
import kotlin.random.Random

class AuthMock(private val delegate: BehaviorDelegate<AuthService>) : AuthService, MockResponse {

    private val token = "mock token"

    override fun login(
        email: String,
        password: String
    ): Call<ResponseWrap<Response1<String>>> =
        delegate.returningResponse(Response1(token).asResponse()).login(email, password)

    override fun register(
        email: String,
        password: String,
        mailCode: String
    ): Call<ResponseWrap<Response1<String>>> =
        delegate.returningResponse(Response1(token).asResponse())
            .register(email, password, mailCode)
}
